﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.CompositeUI;
using Microsoft.Practices.CompositeUI.WinForms;

namespace EventPublicationScope
{
    public class Program : FormShellApplication<WorkItem,Shell>
    {
        [STAThread]
        static void Main() 
        {
            new Program().Run();
        }

        protected override void AfterShellCreated()
        {
            base.AfterShellCreated();

            Subscriber subscriber;
            WorkItem workItem1 = RootWorkItem.WorkItems.AddNew<WorkItem>("WorkItem1");
            subscriber = workItem1.Items.AddNew<Subscriber>();
            subscriber.Message = "WorkItem1";

            WorkItem childWorkItem = workItem1.WorkItems.AddNew<WorkItem>("ChildWorkItem");
            subscriber = childWorkItem.Items.AddNew<Subscriber>();
            subscriber.Message = "ChildWorkItem";

            WorkItem grandChildWorkItem = childWorkItem.WorkItems.AddNew<WorkItem>("GrandChildWorkItem");
            subscriber = grandChildWorkItem.Items.AddNew<Subscriber>();
            subscriber.Message = "GrandChildWorkItem";

            WorkItem workItem2 = RootWorkItem.WorkItems.AddNew<WorkItem>("WorkItem2");
            subscriber = workItem2.Items.AddNew<Subscriber>();
            subscriber.Message = "WorkItem2";
        }
    }
}
